package com.amos.think.user.command;


import com.amos.think.common.exception.ThinkBizException;
import com.amos.think.domain.gateway.UserGateway;
import com.amos.think.domain.user.UserEntity;
import com.amos.think.dto.data.ErrorCode;
//import com.amos.think.user.command.mq.ProduceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Objects;

@Component
public class UserDeleteCmdExe {

    @Autowired
    private UserGateway userGateway;



    public void execute(String deleteId,String userId){

        UserEntity user = userGateway.findById(deleteId);
        if (Objects.isNull(user)) {
            throw new ThinkBizException(ErrorCode.B_USER_UNDEFINED);
        }
        userGateway.deleteByUserId(deleteId,userId);
    }


}
